package com.gy.niuer.controller;


import com.gy.niuer.domain.Appointment;
import com.gy.niuer.domain.Patient;
import com.gy.niuer.service.AppointmentService;
import com.gy.niuer.service.PatientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/patient")
@CrossOrigin
public class PatientController {


    @Autowired
    PatientService patientService;

    @GetMapping("/selectAllPatient")
    public List<Patient> selectAllPatient(){
        List<Patient> patients = patientService.selectAllPatient();
        return patients;
    }

    @PostMapping
    public boolean addPatient(@RequestBody Patient user){
        System.out.println(user.getIdCard());
        patientService.addPatient(user);
        return true;
    }


}
